/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package ch.uzh.ifi.seal.ssqa.model.impl;

import ch.uzh.ifi.seal.ssqa.model.ModelPackage;
import ch.uzh.ifi.seal.ssqa.model.Revision;
import ch.uzh.ifi.seal.ssqa.model.RevisionAssessment;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Revision Assessment</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link ch.uzh.ifi.seal.ssqa.model.impl.RevisionAssessmentImpl#getCycComplexity <em>Cyc Complexity</em>}</li>
 *   <li>{@link ch.uzh.ifi.seal.ssqa.model.impl.RevisionAssessmentImpl#getLoc <em>Loc</em>}</li>
 *   <li>{@link ch.uzh.ifi.seal.ssqa.model.impl.RevisionAssessmentImpl#getRevision <em>Revision</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class RevisionAssessmentImpl extends EObjectImpl implements RevisionAssessment {
	/**
	 * The default value of the '{@link #getCycComplexity() <em>Cyc Complexity</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getCycComplexity()
	 * @generated
	 * @ordered
	 */
	protected static final double CYC_COMPLEXITY_EDEFAULT = 0.0;

	/**
	 * The cached value of the '{@link #getCycComplexity() <em>Cyc Complexity</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getCycComplexity()
	 * @generated
	 * @ordered
	 */
	protected double cycComplexity = CYC_COMPLEXITY_EDEFAULT;

	/**
	 * The default value of the '{@link #getLoc() <em>Loc</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLoc()
	 * @generated
	 * @ordered
	 */
	protected static final int LOC_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getLoc() <em>Loc</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLoc()
	 * @generated
	 * @ordered
	 */
	protected int loc = LOC_EDEFAULT;

	/**
	 * The cached value of the '{@link #getRevision() <em>Revision</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRevision()
	 * @generated
	 * @ordered
	 */
	protected Revision revision;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected RevisionAssessmentImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ModelPackage.Literals.REVISION_ASSESSMENT;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public double getCycComplexity() {
		return cycComplexity;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setCycComplexity(double newCycComplexity) {
		double oldCycComplexity = cycComplexity;
		cycComplexity = newCycComplexity;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.REVISION_ASSESSMENT__CYC_COMPLEXITY, oldCycComplexity, cycComplexity));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getLoc() {
		return loc;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setLoc(int newLoc) {
		int oldLoc = loc;
		loc = newLoc;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.REVISION_ASSESSMENT__LOC, oldLoc, loc));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Revision getRevision() {
		if (revision != null && revision.eIsProxy()) {
			InternalEObject oldRevision = (InternalEObject)revision;
			revision = (Revision)eResolveProxy(oldRevision);
			if (revision != oldRevision) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ModelPackage.REVISION_ASSESSMENT__REVISION, oldRevision, revision));
			}
		}
		return revision;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Revision basicGetRevision() {
		return revision;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setRevision(Revision newRevision) {
		Revision oldRevision = revision;
		revision = newRevision;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.REVISION_ASSESSMENT__REVISION, oldRevision, revision));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ModelPackage.REVISION_ASSESSMENT__CYC_COMPLEXITY:
				return getCycComplexity();
			case ModelPackage.REVISION_ASSESSMENT__LOC:
				return getLoc();
			case ModelPackage.REVISION_ASSESSMENT__REVISION:
				if (resolve) return getRevision();
				return basicGetRevision();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ModelPackage.REVISION_ASSESSMENT__CYC_COMPLEXITY:
				setCycComplexity((Double)newValue);
				return;
			case ModelPackage.REVISION_ASSESSMENT__LOC:
				setLoc((Integer)newValue);
				return;
			case ModelPackage.REVISION_ASSESSMENT__REVISION:
				setRevision((Revision)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ModelPackage.REVISION_ASSESSMENT__CYC_COMPLEXITY:
				setCycComplexity(CYC_COMPLEXITY_EDEFAULT);
				return;
			case ModelPackage.REVISION_ASSESSMENT__LOC:
				setLoc(LOC_EDEFAULT);
				return;
			case ModelPackage.REVISION_ASSESSMENT__REVISION:
				setRevision((Revision)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ModelPackage.REVISION_ASSESSMENT__CYC_COMPLEXITY:
				return cycComplexity != CYC_COMPLEXITY_EDEFAULT;
			case ModelPackage.REVISION_ASSESSMENT__LOC:
				return loc != LOC_EDEFAULT;
			case ModelPackage.REVISION_ASSESSMENT__REVISION:
				return revision != null;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (cycComplexity: ");
		result.append(cycComplexity);
		result.append(", loc: ");
		result.append(loc);
		result.append(')');
		return result.toString();
	}

} //RevisionAssessmentImpl
